<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html>
<head>
<title>新闻列表</title>
<%@ include file="/WEB-INF/views/manager/include.inc.jsp"%>
<link rel="stylesheet" href="${contextPath }/styles/zTree/css/zTreeStyle/zTreeStyle.css">
</head>
<body>
<!--top s-->
<c:import url="/public/header?tag=Config" />
<!--top end-->
<div class="m_main">
  <!--left s-->
  <c:import url="/public/left?tag=Config&tag1=Article" />
  <!--left end-->
  <!--right s-->
  <div class="m_right fl">
	<div class="inquiry">
	  <feing:paginationForm action="${contextPath }/manager/article/list" page="${page }">
		<input type="hidden" name="column.id" value="${param['column.id'] }" />
		<input type="hidden" name="column.name" value="${param['column.name'] }" />
		<input type="hidden" name="title" value="${param.title }" />
	  </feing:paginationForm>
	  <form method="post" action="${contextPath }/manager/article/list">
        <div class="padding4">
    	  <div class="dis_box">
    	    <ul class="dept4 fmy">
    		  <li style="width:310px; float:left;">
          	    <div class="spant tr fl ">栏目</div>
                <input id="select_column" type="text" name="column.name" value="${param['column.name'] }" class="treeint intt2 ell" readonly style="background-color: white;" />
                <input type="hidden" name="column.id"/>
              </li>
              <li style="width:310px; float:left;">
                <div class="spant tr fl ">标题</div>
                <input name="title" type="text" class="intt fl" value="${param.title }" />
              </li>
              <li style="width:310px; float:right;">
		  	    <input name="" type="submit" class="btnbase fr" value="查找" />
		  	  </li>
    	    </ul>
    	  </div>
    	</div>
	  </form>
	</div>
	<div class="r_box">
	  <div class="title1"><h3>新闻列表</h3></div>
	  <div class="btnbox">
		<shiro:hasPermission name="Article:save">
		  <input name="" type="button" class="btnbase fl" value="新 增" onclick="location.href='${contextPath }/manager/article/create'" />
	    </shiro:hasPermission>
	  </div>
	  <div class="list_tab">
		<table>
		  <thead>
			<tr>
			  <th class="nub"></th>
			  <th>栏目</th>
			  <th style="width:40%">标题</th>
			  <th>作者</th>
			  <th style="width:20%">发布时间</th>
			  <th></th>
			</tr>
		  </thead>
		  <tbody>
			<c:forEach var="article" items="${articleList }" varStatus="status">
			  <c:choose><c:when test="${status.index % 2 == 0 }"><tr></c:when><c:otherwise><tr class="odd"></c:otherwise></c:choose>
				<td class="nub">${status.index + 1 }</td>
				<td class="ell">${article.column.name }</td>
				<td class="ell">${article.title }</td>
				<td class="ell">${article.author }</td>
				<td><fmt:formatDate value="${article.createTime }" pattern="yyyy-MM-dd HH:mm" /></td>
				<td>
				  <shiro:hasPermission name="Article:edit">
				    <a href="${contextPath }/manager/article/update/${article.id}">修改</a>&nbsp;
				  </shiro:hasPermission>
				  <shiro:hasPermission name="Article:view">
				    <a href="${contextPath }/manager/article/view/${article.id}">详情</a>&nbsp;
				  </shiro:hasPermission>
				  <shiro:hasPermission name="Article:delete">
				    <a href="javascript:deleteArticle(${article.id })">删除</a>
				  </shiro:hasPermission>
				</td>
			  </tr>
			</c:forEach>
		  </tbody>
		</table>
		<div class="pagebox">
		  <!--翻页-->
		  <feing:pagination page="${page }" choosePages="true" />
		  <!--翻页-->
		</div>
	  </div>
	</div>
  </div>
  <!--right end-->
</div>
<div class="foot"></div>
<div id="select_tree_menu_column" class="menuContent" style="display:none; position: absolute; z-index:32; width:200px; background-color:#FFF; border:1px solid rgb(175,175,175); border-top:none;">
  <ul id="select_tree_column" class="ztree"></ul>
</div>

<script src="${contextPath }/styles/zTree/jquery.ztree.core.min.js"></script>
<script src="${contextPath }/styles/public/js/zTreeUtil.js"></script>
<script>
$(function(){
	zTreeUtil.init("select_column", JSON.parse('${columnList}'));
});
function deleteArticle(id) {
	if (confirm("确定要删除吗？")) {
		$.post2("${contextPath}/manager/article/delete/" + id, {}, callbackRef, "json");
	}
}
function close2refresh() {
	var param = "?pageNum=" + $("#p_pageNum").val();
	param += "&title=${param.title}";
	param += "&column.id=${param['column.id']}";
	goToPage(path + "/manager/article/list" + param);
}
</script>
</body>
</html>